package cn.com.git.example.common.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author zhangzhenfu
 * @Description
 * @date 2021/3/31 11:19
 */
public class BaseCacheService {
    //根关键字
    protected String CACHE_ROOT_KEY = "spring_boot_api";
    //键值间隔符
    protected String CACHE_KEY_SPACE = ":";

    @Autowired
    protected RedisTemplate<Object, Object> redisTemplate;

    protected String buildKey(String prefix,String key) {
        return new StringBuilder(CACHE_ROOT_KEY).append(CACHE_KEY_SPACE)
                .append(prefix).append(CACHE_KEY_SPACE)
                .append(key).toString();
    }
}
